clear;
load('options_BE.mat')
Data_UK2_r= zeros(1,1);
Data_UK2_r(1,1)= 1.0191334;
kjInd_UK2_r_one = zeros(1,1);

    sigma=Data_UK2_r(1,1);    
    k_cool = @(k_j)sd_loge_int(k_j, sigma);
    x = fsolve(k_cool,5, options_BE)
    kjInd_UK2_r_one(1,1)=x;
    save('kjInd_UK2_r_one.mat', 'kjInd_UK2_r_one');

kappa1 = zeros(1,1);
kappa2 = zeros(1,1);
theta = zeros(1,1);

fun3 = @(z, k) (1-(z.^2)).*(z.*(exp(z))).^k .*exp(z);
Integral3 = integral(@(z)fun3(z, kjInd_UK2_r_one),0,1);

kappa1=kjInd_UK2_r_one.*exp(-kjInd_UK2_r_one-1).*Integral3;
kappa2=kappa1./kjInd_UK2_r_one;
theta=(kappa2.*(kjInd_UK2_r_one+1))./((1./(kjInd_UK2_r_one+1))-(kappa1+kappa2)  );

kappajInd_UK2_one=kappa2;
thetajInd_UK2_one=theta;
save('thetajInd_UK2_one.mat', 'thetajInd_UK2_one');
save('kappajInd_UK2_one.mat', 'kappajInd_UK2_one');
    
Data_FR2_r= zeros(1,1);
Data_FR2_r(1,1)=1.0529405;
kjInd_FR2_r_one = zeros(1,1);

    sigma=Data_FR2_r(1,1);    
    k_cool = @(k_j)sd_loge_int(k_j, sigma);
    x = fsolve(k_cool,5, options_BE)
    kjInd_FR2_r_one(1,1)=x;
    save('kjInd_FR2_r_one.mat', 'kjInd_FR2_r_one');

kappa1 = zeros(1,1);
kappa2 = zeros(1,1);
theta = zeros(1,1);

fun3 = @(z, k) (1-(z.^2)).*(z.*(exp(z))).^k .*exp(z);
Integral3 = integral(@(z)fun3(z, kjInd_FR2_r_one),0,1);

kappa1=kjInd_FR2_r_one.*exp(-kjInd_FR2_r_one-1).*Integral3;
kappa2=kappa1./kjInd_FR2_r_one;
theta=(kappa2.*(kjInd_FR2_r_one+1))./((1./(kjInd_FR2_r_one+1))-(kappa1+kappa2)  );

kappajInd_FR2_one=kappa2;
thetajInd_FR2_one=theta;
save('thetajInd_FR2_one.mat', 'thetajInd_FR2_one');
save('kappajInd_FR2_one.mat', 'kappajInd_FR2_one');